package com.web.service;


import com.web.dao.UserCollectionMapper;
import com.web.entity.InstantInfoCollection;
import com.web.entity.UserCollection;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserCollectionService {
    @Resource
    private UserCollectionMapper userCollectionMapper;


    /**
     * 用户添加收藏
     * @param userCollection
     */
    public void insertSelective(UserCollection userCollection) {
        userCollectionMapper.insertSelective(userCollection);
    }

    /**
     * 我的收藏
     * @param userId
     * @param typeId
     * @param type
     * @return
     */
    public UserCollection findCollection(String userId, Integer typeId, Integer type) {
       return userCollectionMapper.findCollection(userId,typeId,type);
    }

    /**
     * 取消用户收藏
     * @param userId
     * @param typeId
     * @param type
     */
    public void deleteUserCollection(String userId, Integer typeId, Integer type) {
        userCollectionMapper.deleteUserCollection(userId,typeId,type);
    }

    /**
     * 查询我的所有收藏
     * @param userId
     * @return
     */
    public List<InstantInfoCollection> findMyCollection(String userId) {
        return userCollectionMapper.findAllMyCollection(userId);
    }
}
